/*
 * @Description: 审批单相应API
 * @Version: 2.0
 * @Autor: 许国辉
 * @Date: 2022-12-02 09:44:02
 * @LastEditors: 许国辉
 * @LastEditTime: 2023-02-09 16:20:16
 */
import { defHttp } from '/@/utils/http/axios';
import { ExamineApprove, ExamineApproveParams } from './model/ExamineApproveModel';
import { getNewDate } from './getDateAPI';
import { baseResultModel } from '../model/baseResultModel';
enum Api {
  getExamineApprovesByParams = '/examineApprove/getExamineApprovesByParams',
  invalidExamineApprove = '/examineApprove/invalidExamineApprove',
  syncExamineApprove = '/examineApprove/syncExamineApprove',
}
export function getExamineApprovesByParams(params: ExamineApproveParams) {
  if (params.createTimeStart === undefined) {
    params.createTimeStart = getNewDate('before', 1);
  }
  return defHttp.post<ExamineApprove>({
    url: Api.getExamineApprovesByParams,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}

export function invalidExamineApprove(params: { examID: number }) {
  return defHttp.post<baseResultModel>({
    url: Api.invalidExamineApprove,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}
// 审批单同步
export function synchronizationExamineApprove(params: { examID: number }) {
  return defHttp.post<baseResultModel>({
    url: Api.syncExamineApprove,
    params,
    headers: {
      ignoreCancelToken: true,
    },
  });
}
